﻿<Window x:Class="GoToBrowser.Options.ConfigWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Background="WhiteSmoke"
        ResizeMode="NoResize" WindowStartupLocation="CenterOwner" Height="320" Width="640">
    <Window.Resources>
        <Style TargetType="{x:Type Button}">
            <Setter Property="Width" Value="90" />
            <Setter Property="Height" Value="20" />
            <Setter Property="Margin" Value="2.5, 0" />
        </Style>

        <Style TargetType="{x:Type TextBlock}">
            <Setter Property="Margin" Value="0, 2.5" />
        </Style>

        <Style TargetType="{x:Type ListView}">
            <Setter Property="Margin" Value="0, 2.5" />
        </Style>

        <Style x:Key="ReadOnlyTextBox" TargetType="{x:Type TextBox}">
            <Setter Property="IsReadOnly" Value="True" />
            <Setter Property="IsTabStop" Value="False" />
            <Setter Property="TextAlignment" Value="Center" />
            <Setter Property="Background" Value="Transparent" />
            <Setter Property="BorderThickness" Value="0" />
            <Setter Property="ContextMenu">
                <Setter.Value>
                    <ContextMenu Background="White">
                        <MenuItem Command="ApplicationCommands.Copy" />
                    </ContextMenu>
                </Setter.Value>
            </Setter>
        </Style>
    </Window.Resources>

    <Grid Margin="12">
        <Grid.RowDefinitions>
            <RowDefinition Height="55"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="30"/>
        </Grid.RowDefinitions>

        <StackPanel Grid.Row="0">
            <Label Content="URL Format(_U)" Target="{Binding ElementName=urlFormat}" />
            <TextBox x:Name="urlFormat" />
        </StackPanel>

        <StackPanel Grid.Row="1">
            <TextBlock Text="Defines the URL format of destination file." />
            <StackPanel Orientation="Horizontal">
                <TextBlock Text=" ex) " VerticalAlignment="Center"/>
                <TextBox Text="http://code.google.com/p/{SN}/source/browse/trunk/{SN}{FP}#{LN}" Style="{StaticResource ReadOnlyTextBox}" VerticalAlignment="Center"/>
            </StackPanel>
            <TextBlock Text="The following special keywords 'Key' or 'Abbr.' will be replaced with current values." />

            <ListView ItemsSource="{Binding}">
                <ListView.Resources>
                    <Style TargetType="ListViewItem">
                        <Setter Property="IsTabStop" Value="False" />
                        <EventSetter Event="MouseDoubleClick" Handler="UrlFormatKeyDoubleClick"/>
                    </Style>
                </ListView.Resources>

                <ListView.View>
                    <GridView AllowsColumnReorder="False">
                        <GridViewColumn Header="Key" DisplayMemberBinding="{Binding Key}" Width="150" />
                        <GridViewColumn Header="Abbr." DisplayMemberBinding="{Binding Abbreviation}" Width="50" />
                        <GridViewColumn Header="Description" DisplayMemberBinding="{Binding Description}" Width="370"/>
                    </GridView>
                </ListView.View>
            </ListView>
        </StackPanel>

        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="2">
            <Button Content="OK" Click="OKClick" />
            <Button Content="Cancel" Click="CancelClick"  />
        </StackPanel>
    </Grid>
</Window>
